package com.songcha.module_category.ui.adapter

import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import com.songcha.module_category.bean.CategoryChannelListBean
import com.songcha.module_category.ui.fragment.category_child.CategoryChildFragment

class CategoryTabAdapter(fm: FragmentManager, val list:MutableList<CategoryChannelListBean.ChannelBean>): FragmentStatePagerAdapter(fm) {
    override fun getCount(): Int {
        return list.size
    }

    override fun getItem(position: Int): Fragment {
        val frag=CategoryChildFragment()
        val bundle=Bundle()
        bundle.putInt("channel_id",list[position].channelId)
        bundle.putInt("position",position)
        frag.arguments=bundle
        return frag
    }

    override fun getPageTitle(position: Int): CharSequence? {
        return list[position].titleName
    }

}